﻿@model FlashCards.WebApp.Models.FlashcardsModel
@{
    ViewBag.Title = "Index";
}
<h2>
    Index</h2>
<script type="text/javascript" src="~/Scripts/Silverlight.js"></script>

@Html.ActionLink("create new flashcard", "CreateFlashcardSet", new { userId = Model.UserID })


@if (Model != null && Model.FlashcardSets.Count > 0)
{
    <table>
        <tr>
            <th>Name</th>
            <th>Tags</th>
            <th>Date modified</th>
            <th>Flashcards</th>
            <th></th>
            <th></th>
            <th></th>
            <th></th>
        </tr>
        @foreach (var set in Model.FlashcardSets)
        {
            <tr>
                <td>
                    @Html.DisplayFor(x => set.Name)
                </td>
                <td>
                    @Html.DisplayFor(x => set.Tags)
                </td>
                <td>
                    @Html.DisplayFor(x => set.DateModified)
                </td>
                <td>
                    @Html.DisplayFor(x => set.FlashcardsCount)
                </td>
                <td>
                    @Html.ActionLink("repeat", "RepeatFlashcardSet", new { flashcardSetId = set.Id, userId = Model.UserID })
                </td>
                <td>
                    @Html.ActionLink("view progress", "ViewFlashcardProgress", new { flashcardSetId = set.Id, userId = Model.UserID })
                </td>
                <td>
                    @Html.ActionLink("edit", "EditFlashcardSet", new { flashcardSetId = set.Id, userId = Model.UserID })
                </td>
                <td>
                    @Html.ActionLink("delete", "DeleteFlashcardSet", new { flashcardSetId = set.Id, userId = Model.UserID })
                </td>
            </tr>
        }
    </table>
}
else 
{
    <p>You have no flashcards</p>     
}
